<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>用户信用档案记录</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="../plugin/jquery-zoomify/zoomify.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/wangEditor-3.0.15/wangEditor.min.js"></script>
    <script src="../plugin/jquery-zoomify/zoomify.min.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../base/base.js'></script>

</head>
<script>
    $(function () {
        var userId = ParamUtil.getQueryString("userId");
        var resp = AjaxUtil.isLogin();
        if (!resp) return;
        var module = 'credit_file';
        var query = [];
        var toolbar = {
            default: [true, false, false, false],// back;add;edit;remove
            dialog: [60, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: [{
                name: '查看详情',
                glyphicon: 'list',
                onclick: 'detail'
            }]
        };
        var formElement = [];
        var url = '/admin/credit_file/find_user?userId=' + userId + '&token=' + BaseConfig.token

        var bootstrapTable = {
            url: url,
            columns: [{
                radio: true
            }, {
                field: 'walletType',
                title: '钱包类型',
                align: 'center',
                formatter: function (value, row, index) {
                    if (value == 10) {
                        return 'BTC';
                    } else if (value == 20) {
                        return 'ETH';
                    } else if (value == 100) {
                        return 'BHPC';
                    } else {
                        return '未知';
                    }
                },
            }, {
                field: 'borrowingAmount',
                title: '借款笔数',
                align: 'center'
            }, {
                field: 'payOffAmount',
                title: '还清笔数',
                align: 'center',
            }, {
                field: 'overdueNoRepayAmount',
                title: '逾期未还笔数',
                align: 'center'
            }, {
                field: 'overduePayOffAmount',
                title: '逾期还款笔数',
                align: 'center',
            }, {
                field: 'overduePayOffBalance',
                title: '逾期还款金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }, {
                field: 'lateAmount',
                title: '迟还笔数',
                align: 'center'
            }, {
                field: 'advanceAmount',
                title: '提前笔数',
                align: 'center'
            }, {
                field: 'advanceBalance',
                title: '提前还款金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }, {
                field: 'borrowingBalance',
                title: '已借金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }, {
                field: 'repaidBalance',
                title: '已还金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }, {
                field: 'returnedBalance',
                title: '待还金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }, {
                field: 'overduePayOffBalance',
                title: '逾期还款金额',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.money
            }]
        };
        credit_file = SingleTablePageCreateUtil.createInstance(module, query, toolbar, formElement, bootstrapTable);

        credit_file.detail = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#credit_file_table');
            if (!row) return false;
           window.location.href = 'credit_file_detail.html?userId=' + userId+ '&walletType=' + row.walletType;
        };
    });
</script>
</html>